<?php defined('IN_ADMIN') or exit('No permission resources.');?>
<?php include $this->admin_tpl('header', 'admin');?>

<div class="subnav">
	<div class="content-menu ib-a blue line-x">
		<a href="./index.php?m=agency&c=manage&a=init" class="on"><em><?php echo L($column)?>列表</em></a>
		<span>|</span>

		<?php if(isset($_GET['id'])){?>
			<a href="./index.php?m=agency&c=manage&a=add"><em>添加</em></a>
			<span>|</span>
			<a href="./index.php?m=agency&c=manage&a=init" ><em>返回上一级</em></a>
		<?php }else{?>
			<a href="./index.php?m=agency&c=manage&a=add"><em><?php echo L($column)?>添加</em></a>
		<?php }?>
	</div>
</div>

<div class="pad-lr-10">
	<form name="searchform" action="" method="get">
		<input type="hidden" value="agency" name="m">
		<input type="hidden" value="manage" name="c">
		<input type="hidden" value="init" name="a">
		<?php if(isset($_GET['id'])){?>
			<input type="hidden" value="<?=$_GET['id']?>" name="id">
		<?php }?>
		<table width="100%" cellspacing="0" class="search-form">
			<tbody>
			<tr>
				<td>
					<div class="explain-col">
						名称：<input name="name" type="text" value="<?php if(isset($_GET['name'])) {echo $_GET['name'];}?>"
										 class="input-text" />
						 校区：  <select name="branch" >
						           <option value="">请选择</option>
                				<?php foreach($agency_branch as $key=>$value){?>
                				    <option value='<?=$key?>' <?php if($_GET['branch']==$key){echo 'selected';}?>><?=$value?></option>
                				<?php }?>
                				</select>
						 类型： <select name="type" >
						           <option value="">请选择</option>
                				<?php foreach($agency_type as $k=>$v){?>
                				    <option value='<?=$k?>' <?php if($_GET['type']==$k){echo 'selected';}?>><?=$v?></option>
                				<?php }?>
                				</select>
						<input type="submit" name="search"  class="button" value="<?php echo L('search')?>" />
					</div>
				</td>
			</tr>
			</tbody>
		</table>
	</form>


	<form name="myform" action="?m=agency&c=manage&a=del" method="post"
		onsubmit="return confirm('<?php echo L('confirm')?>')">
		<div class="table-list">
			<table width="100%" cellspacing="0">
				<thead>
					<tr>
						<th align="center" width="20"><input type="checkbox" value=""
							id="check_box" onclick="selectall('id[]');"></th>
						<th align="center" width="40">序列号</th>
						<th align="center" width="100"><?php echo '名称'?></th>
						<th align="center" width="80"><?php echo '校区'?></th>
						<th align="center" width="80"><?php echo '机构方形图' ?></th>
						<th align="center" width="80"><?php echo "类型"?></th>
						<th align="center" width="100"><?php echo "联系人" ?></th>
						<th align="center" width="100"><?php echo "联系电话"; ?></th>
						<th align="center" width="80"><?php echo "上次编辑者"; ?></th>
						<th align="center" width="180px"><?php echo "操作"?></th>
					</tr>
				</thead>
				<tbody>
<?php
if(!empty($agencyinfo)){
foreach ($agencyinfo as $k => $v) {
    ?>
    <tr>
						<td align="center"><input type="checkbox"
							value="<?php echo $v['id']?>" name="id[]"></td>
						<td align="center"><?php echo $v['id'];?></td>
						<td align="center"><?php  if(!empty($v['full_name'])){echo $v['full_name'];}else{echo"<span style='color:red;'>（未设置）</span>";}?></td>
						<td align="center"><?php if(!empty($v['branch'])){echo $agency_branch[$v['branch']];}else{echo"<span style='color:red;'>（未设置）</span>";}?></td>
						<td align="center"><?php if(isset($v['image_square']) && !empty($v['image_square'])){?><img src="<?=$v['image_square']?>"  height="60" /><?php }else{echo "<span style='color:red;'>（未设置）</span>";}?></td>
						<td align="center"><?php if(!empty($v['type'])){echo $agency_type[$v['type']];}else{echo"<span style='color:red;'>（未设置）</span>";}?></td>
						<td align="center"><?php if(!empty($v['contact_teacher'])){echo $v['contact_teacher'];}else{echo"<span style='color:red;'>（未设置）</span>";}?></td>
						<td align="center"><?php if(!empty($v['contact_tel'])){echo $v['contact_tel'];}else{echo"<span style='color:red;'>（未设置）</span>";}?></td>
						<td align="center"><?php if(!empty($v['publisher'])){echo $v['publisher'];}else{echo"<span style='color:red;'>（未设置）</span>";}?></td>
						<td align="center">
							<a  href="?m=agency&c=manage&a=view&id=<?php echo $v['id']?>"><?php echo  L($column."_view");?></a>&nbsp; |&nbsp;
							<a  href="?m=agency&c=manage&a=edit&id=<?php echo $v['id']?>"><?php echo  L($column."_edit");?></a>&nbsp;|&nbsp;
							<a href="?m=agency&c=manage&a=del&id=<?php echo $v['id']?>&is_activity=<?=$is_activity?>"
							onClick="return confirm('<?php echo L('confirm')?>')"><?php echo  L($column."_del")  ?></a>&nbsp;|&nbsp;
							<a  href="?m=agency&c=source&a=init&source_type=1&agency_id=<?php echo $v['id']?>">关联资源</a>
                        </td>
					</tr>
<?php
}
}else{
    echo "<tr><td colspan='11' style='color:red;font-size:18px;text-align:center;'><span>暂无数据！</span></td></tr>";
}
?>
</tbody>
			</table>

			<div class="btn">
				<label for="check_box"><a href="#"
					onClick="javascript:$('input[type=checkbox]').attr('checked', true)"><?php echo L('select_all')?></a>/<a
					href="#"
					onClick="javascript:$('input[type=checkbox]').attr('checked', false)"><?php echo L('cancel')?></a></label>
				<input type="submit" class="button" name="dosubmit"
					value="<?php echo L('delete')?>" />
			</div>

<div id="pages"><?php echo $pages?></div>
		</div>
	</form>
</div>
</body>
</html>